// 1. 导入用于创建store实例的createStore函数
import {createStore} from 'redux'

// 2. 创建reducer函数(reducer是一个纯函数)
const reducer = (state = [],action)=>{
  // 添加数据的业务逻辑
  switch(action.type){
    case "add":{
      let todos = [...state,action.payload]
      console.log(todos)
      return todos
    }
    default:
      return state
  }
}

// 3. 创建store实例
const store = createStore(reducer)


// 4. 导出store
export default store